import java.util.Scanner;

public class ArraySort {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] a = new int[n][];
        for(int i = 0; i < n; i++){
            int m = in.nextInt();
            a[i] = new int[m];
        }

        int sub = 0;
        for(int i = 0; i < n; i++) {
            for(int j = a[i].length - 1; j >= 0; j--) {
                a[i][j] = n*n - sub;
                sub++;
            }
        }
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < a[i].length; j++) {
                System.out.printf("%d ",a[i][j]);
            }
            System.out.println();
        }
    }

}
